<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>广东国防教育学会</title>
		<meta name="viewport" content="initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.min.css" />
		<link rel="stylesheet" href="http://idangero.us/swiper/dist/css/swiper.min.css" />
		<link rel="stylesheet" href="/Public/Home/activity/css/style.css" />
	</head>
	<body>


		<div class="bar bar-nav">
			<h1 class="title">我的申请</h1>
			<i class="icon icon-left" onclick="window.history.go(-1);"></i>
		</div>
		<div class="content">
		<form action="<?php echo U('Index/applyUserType');?>" method="post" id="apply_form" enctype="multipart/form-data">
			<div class="list-block join">
		    <ul>
		    <li>
		        <div class="item-content">
		          <div class="item-media"><i class="icon icon-form-email"></i></div>
		          <div class="item-inner">
		            <div class="item-title label">申请类型：</div>
		            <div class="item-input">
		              <select name="apply_type">
		              	<option value="">请选择</option>
		              	<option <?php if($apply['apply_type'] == 3): ?>selected<?php endif; ?> value="3">副会长</option>
		              	<option <?php if($apply['apply_type'] == 4): ?>selected<?php endif; ?> value="4">理事</option>
		              	<option <?php if($apply['apply_type'] == 5): ?>selected<?php endif; ?> value="5">国旗文化</option>
		              	<option <?php if($apply['apply_type'] == 6): ?>selected<?php endif; ?> value="6">军事运动</option>
		              	<option <?php if($apply['apply_type'] == 7): ?>selected<?php endif; ?> value="7">国防传媒</option>
		              	<option <?php if($apply['apply_type'] == 8): ?>selected<?php endif; ?> value="8">军事警觉</option>
		              </select>
		            </div>
		          </div>
		        </div>
		      </li>
		    
		      <!-- Text inputs -->
		      <li>
		        <div class="item-content">
		          <div class="item-media"><i class="icon icon-form-name"></i></div>
		          <div class="item-inner">
		            <div class="item-title label">您的姓名：</div>
		            <div class="item-input">
		              <input type="text" name="full_name" placeholder="请输入姓名" value="<?php echo ($apply['full_name']); ?>" />
		            </div>
		          </div>
		        </div>
		      </li>
		      
		      <li>
		        <div class="item-content">
		          <div class="item-media"><i class="icon icon-form-name"></i></div>
		          <div class="item-inner">
		            <div class="item-title label">单位名称：</div>
		            <div class="item-input">
		              <input type="text" name="company" placeholder="请输入单位名称" value="<?php echo ($apply['company']); ?>" />
		            </div>
		          </div>
		        </div>
		      </li>
		      
		      <li>
		        <div class="item-content">
		          <div class="item-media"><i class="icon icon-form-gender"></i></div>
		          <div class="item-inner">
		            <div class="item-title label">E_mail：</div>
		            <div class="item-input">
		              <input type="text" name="email" placeholder="邮箱地址" value="<?php echo ($apply['email']); ?>" />
		            </div>
		          </div>
		        </div>
		      </li>
		      <!-- Date -->
		      <li>
		        <div class="item-content">
		          <div class="item-media"><i class="icon icon-form-calendar"></i></div>
		          <div class="item-inner">
		            <div class="item-title label">证明材料：</div>
		            <div class="item-input">
		             <input type="file" name="prove_img">
		             <a href="<?php echo ($apply['prove_img']); ?>" target="_blank">
		             	<img src="<?php echo ($apply['prove_img']); ?>" width="100px" height="100px" />
		             </a>
		            </div>
		          </div>
		        </div>
		        <p style="font-size:12px;color:green;padding:0 1rem;">温馨提示：图片尺寸建议：600 X 300,小于1M</p>	
		      </li>
		      
		       <!-- Date -->
		      <li style="margin-bottom:10px;">
		        <div class="item-content">
		          <div class="item-media"><i class="icon icon-form-calendar"></i></div>
		          <div class="item-inner">
		            <div class="item-title label">一寸证件照：</div>
		            <div class="item-input">
		             <input type="file" name="card_img">
		             <a href="<?php echo ($apply['card_img']); ?>" target="_blank">
		             	<img src="<?php echo ($apply['card_img']); ?>" width="100px" height="100px" />
		             </a>
		            </div>
		          </div>
		        </div>
		        <p style="font-size:12px;color:green;padding:0 1rem;">温馨提示：图片尺寸建议：413 X 295,小于1M</p>	
		      </li>
		      
		      <li class="align-top" style="margin-bottom:10px;">
		        <div class="item-content">
		          <div class="item-media"><i class="icon icon-form-comment"></i></div>
		          <div class="item-inner">
		            <div class="item-title label">个性签名：</div>
		            <div class="item-input">
		              <textarea name="autograph" placeholder="个性签名"><?php echo (htmlspecialchars_decode($apply['autograph'])); ?></textarea>
		            </div>
		          </div>
		        </div>
		      </li>
		      
		      <li class="align-top" style="margin-bottom:10px;">
		        <div class="item-content">
		          <div class="item-media"><i class="icon icon-form-comment"></i></div>
		          <div class="item-inner">
		            <div class="item-title label">个人简介：</div>
		            <div class="item-input">
		              <textarea name="introduce" placeholder="个人简介"><?php echo (htmlspecialchars_decode($apply['introduce'])); ?></textarea>
		            </div>
		          </div>
		        </div>
		      </li>
		      
		      <li class="align-top">
		        <div class="item-content">
		          <div class="item-media"><i class="icon icon-form-comment"></i></div>
		          <div class="item-inner">
		            <div class="item-title label">补充说明：</div>
		            <div class="item-input">
		              <textarea name="note" placeholder="补充说明"><?php echo (htmlspecialchars_decode($apply['note'])); ?></textarea>
		            </div>
		          </div>
		        </div>
		      </li>
		      
		      <!-- Text inputs -->
		      <li style="margin-top:10px;">
		        <div class="item-content">
		          <div class="item-media"><i class="icon icon-form-name"></i></div>
		          <div class="item-inner">
		            <div class="item-title label">审核状态：</div>
		            <div class="item-input">
		              <input type="text" style="color:red;"  placeholder="审核状态" value="<?php switch($apply['status']): case "1": ?>待审核<?php break;?>
										    <?php case "2": ?>已通过<?php break;?>
										    <?php case "3": ?>不通过<?php break; endswitch;?>" />
		            </div>
		          </div>
		        </div>
		      </li>
		      
		      <?php if($apply['refuse']): ?><li class="align-top">
		        <div class="item-content">
		          <div class="item-media"><i class="icon icon-form-comment"></i></div>
		          <div class="item-inner">
		            <div class="item-title label">不通过原因：</div>
		            <div class="item-input">
		              <textarea placeholder="不通过原因"><?php echo (htmlspecialchars_decode($apply['refuse'])); ?></textarea>
		            </div>
		          </div>
		        </div>
		      </li><?php endif; ?>
		      
		    </ul>
		  </div>
		  <div class="content-block">
		    <div class="row">
		      <div class="col-100 text-center">
		      <input type="hidden" name="act" value="edit" />
		      <button style="width:100%;" class="button button-big button-fill button-danger" <?php if($apply['status'] == 2): ?>disabled<?php endif; ?>>修改</button>
		      </div>
		    </div>
		  </div>
		  </form>
		</div>


		<script type="text/javascript" src="http://g.alicdn.com/sj/lib/jquery/dist/jquery.min.js"></script>
		<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
		<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.min.js' charset='utf-8'></script>
		<script src="http://idangero.us/swiper/dist/js/swiper.min.js"></script>
		<script type="text/javascript" src="/Public/Home/activity/js/huodon.js" ></script>
		<script>
			
			var swiper = new Swiper('.swiper-container', {
				pagination: '.swiper-pagination',
				paginationClickable: true,
				loop:true,    
				grabCursor: true,
				autoplay: 3000
			});
			
			 /* $(document).on('click','.open-preloader', function () {
				 Zepto.showPreloader('加载中...')
				    setTimeout(function () {
				    	 Zepto.hidePreloader();
				    }, 2000); 
			 }); */
			 $(document).on('click','.open-indicator', function () {
				 Zepto.showIndicator();
			     setTimeout(function () {
			    	Zepto.hideIndicator();
			     }, 2000);
			  });
		</script>
		

	</body>

</html>

<script>
	var myreg = /(1[3-9]\d{9})$/;
	var true_or_false = true;
	$("#apply_form").submit(function(){
		 var apply_type = $("select[name='apply_type']").val();
		 var full_name = $("input[name='full_name']").val();
		 var company = $("input[name='company']").val();
		 var code = $("input[name='code']").val();
		 var email = $("input[name='email']").val();
		 var email_regular = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;	//邮箱
		 //var prove_img = $("input[name='prove_img']").val();
		 var autograph = $("textarea[name='autograph']").val();
		 var introduce = $("textarea[name='introduce']").val();
		 var note = $("textarea[name='note']").val();
		 if(apply_type == ''){
			 Zepto.toast('请选择申请类型！', 2000, 'success top');
			 return false;
		 }
		 if(full_name == ''){
			 Zepto.toast('请填写姓名！', 2000, 'success top');
			 return false;
		 }
		 if(company == ''){
			 Zepto.toast('请填写单位名称！', 2000, 'success top');
			 return false;
		 }
		 /* if($("input[name='phone_number']").val() == ''){
			 Zepto.toast('请填写手机号码！', 2000, 'success top');
			 return false;
		 }
		 if(!myreg.test($("input[name='phone_number']").val())){
			 Zepto.toast('手机格式不正确！', 2000, 'success top');
			 return false;
		 } */
		 if(code == ''){
			 Zepto.toast('请填写验证码！', 2000, 'success top');
			 return false;
		 }
		 if(email == ''){
			 Zepto.toast('请填写邮箱！', 2000, 'success top');
			 return false;
		 }
		 if(!email_regular.test(email)){ 
			 Zepto.toast('邮箱格式不正确！', 2000, 'success top');
			 return false;
	 	 }
		 /* if(prove_img == ''){
			 Zepto.toast('请上传证明材料！', 2000, 'success top');
			 return false;
		 } */
		 if(autograph == ''){
			 Zepto.toast('请填写个性签名！', 2000, 'success top');
			 return false;
		 }
		 if(introduce == ''){
			 Zepto.toast('请填写个人简介！', 2000, 'success top');
			 return false;
		 }
	});
	
	  var bt01 = document.getElementById("getCodeBtn");
	  bt01.onclick = function() {
	  var phone_number = $("input[name='phone_number']").val();
		 if(phone_number == ''){
			 Zepto.toast('请填写手机号码！', 2000, 'success top');
			 return false;
		 }
		 if(!myreg.test(phone_number)){
			 Zepto.toast('手机格式不正确！', 2000, 'success top');
			 return false;
		 }
		send_sms(phone_number); 
	    bt01.disabled = true;  //当点击后倒计时时候不能点击此按钮
	    var time = 60;  //倒计时5秒
	    var timer = setInterval(fun1, 1000);  //设置定时器
	    function fun1() {
	      time--;
	      if(time >= 0) {
	        bt01.innerHTML = time + "s后重新发送";
	      }else{
	        bt01.innerHTML = "重新发送";
	        bt01.disabled = false;  //倒计时结束能够重新点击发送的按钮
	        clearTimeout(timer);  //清除定时器
	        time = 60;  //设置循环重新开始条件
	      }
	    }
	  } 
	
	 /* $("#getCodeBtn").click(function(){
		 that = $(this);
		 var phone_number = $("input[name='phone_number']").val();
		 if(phone_number == ''){
			 Zepto.toast('请填写手机号码！', 2000, 'success top');
			 return false;
		 }
		 if(!myreg.test(phone_number)){
			 Zepto.toast('手机格式不正确！', 2000, 'success top');
			 return false;
		 }
		 that.attr('disabled',true);  //当点击后倒计时时候不能点击此按钮
		 var time = 60;  //倒计时60秒
		 var timer = setInterval(fun1, 1000);  //设置定时器
		 function fun1() {
		      time--;
		      if(time >= 0) {
		    	  that.text(time + "s后重新发送");
		      }else{
		    	that.text = "重新发送验证码";
		    	that.attr('disabled',false);  //倒计时结束能够重新点击发送的按钮
		        clearTimeout(timer);  //清除定时器
		        time = 60;  //设置循环重新开始条件
		      }
		    }
	});  */
	
	//发送短信
	function send_sms(phone_number){
		 $.ajax({
	 			type : "get",
	 			//url:"/index.php?m=Mobile&c=User&a=collect_list&is_ajax=1&p="+page,//+tab,			
	 			url:"<?php echo U('Index/send_sms');?>",//+tab,
	 			data : {'phone_number':phone_number},// 你的formid 搜索表单 序列化提交
	 			dataType : 'json',
	 			success: function(data){
	 				if(data.status == 1){
	 					return true;
	 				}else{
	 					Zepto.alert(''+data.message+'');
	 					//Zepto.toast(''+data.message+'', 2000, 'success top');
	 					return false;
	 				}
	 			}
	 		});  
	}
	
	//检查验证码
	 function check_code(code, true_or_false){
		 $.ajax({
	 			type : "get",
	 			//url:"/index.php?m=Mobile&c=User&a=collect_list&is_ajax=1&p="+page,//+tab,			
	 			url:"<?php echo U('Index/check_code');?>",//+tab,
	 			data : {'code': code},// 你的formid 搜索表单 序列化提交
	 			dataType : 'json',
	 			async: false,
	 			success: function(data){
	 				if(data.status == 1){
	 					true_or_false = true;
	 				}else if(data.status == 2){
	 					true_or_false = false;
	 					Zepto.alert(''+data.message+'');
	 					//Zepto.toast(''+data.message+'', 2000, 'success top');
	 				}
	 			}
	 		});
	 }
</script>